/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package multichatclient;

import java.applet.Applet;
import java.awt.event.*;
import javax.swing.JFrame;

public class ClientApplet extends Applet {

    public static int PORT = 1234;     // server details
    String host = "localhost";
    Communication comm;
    ClientGui gui;

    public ClientApplet() {

    }

    @Override
    public void init() {
        gui = new ClientGui();
        host = gui.tfHost.getText();
        comm = new Communication(host, PORT, gui);
        gui.addComm(comm);
        this.add(gui);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        ClientApplet applet = new ClientApplet();

        JFrame frame = new JFrame("MultiChat Client");
        frame.setSize(430, 600);
        frame.add(applet);
        applet.init();
        applet.start();

        frame.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(1);
            }
        });

        frame.setVisible(true);
    }
}
